public class  shareLib{
	public static void savexxPrefes(Context context, boolean wifiState) {
        SharedPreferences.Editor editor = context.getSharedPreferences("wireless", 0).edit();
        //up is could set xml name next is name for package PreferenceManager.getDefaultSharedPreferences(context).edit();
        editor.putBoolean("wifiState", wifiState);
        editor.commit();
    }
public  boolean getPrefsSound(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("nima", true);
   }
public  boolean isProcessRunning(String processName)  {
        boolean running = false;
        try {

            Process process = Runtime.getRuntime().exec("ps");

            BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
            String line;

            line = in.readLine();
            if (line == null) {

                return running;
            }

            while (line != null) {


                if (line.contains(processName)) {

                    running = true;
                    break;
                }
                line = in.readLine();

            }


            in.close();
            process.waitFor();
        }catch (Exception e){

            e.printStackTrace();
        }

        return running;
    }
////	///////////////
  public  static void enableWiFi(Context context, boolean enable){

        if(enable){

            Toast.makeText(context, "wifi will open", Toast.LENGTH_SHORT).show();
        }else{

            Toast.makeText(context, "wifi will close", Toast.LENGTH_SHORT).show();
        }

        ((WifiManager) context.getSystemService("wifi")).setWifiEnabled(enable);
    }
  public  static boolean checkWifiState(Context context){

        try{

            WifiManager mWifiManager = (WifiManager)context.getSystemService("wifi");
            WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
            if(!mWifiManager.isWifiEnabled() || wifiInfo.getSSID() == null){

                return false;
            }
            return true;
        }catch (Exception e){

            e.printStackTrace();

            return false;
        }


    }
 public static String getWifiIp(Context context){

        int ip = ((WifiManager)context.getSystemService("wifi")).getConnectionInfo().getIpAddress();
        
        return (ip & MotionEventCompat.ACTION_MASK)+"."+((ip >> 8 ) & MotionEventCompat.ACTION_MASK) +"."+((ip >> 16 ) & MotionEventCompat.ACTION_MASK)+"."+((ip >> 24 ) & MotionEventCompat.ACTION_MASK);
    }
 public static boolean setProp(String property,String value){

        return runRootCommand("setprop "+property+""+value);
    }
	  public static  void  WiFidialog(final Context context){

        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setMessage("good").setCancelable(true).setPositiveButton("确定", new DialogInterface.OnClickListener() {
				//the setcacelable default is false 
		   @Override
            public void onClick(DialogInterface dialog, int id) {

                System.exit(0);

            }
        }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(context, "you click negative button", Toast.LENGTH_SHORT).show();
            }
        });

        builder.setTitle("title");
        builder.create();
        builder.show();

    }
	
	///////////////end dialog.show();
	
	
	///notification one  create way
	
	public  showNotification(){
		
		Intent intent = new Intent(this,MainActivity.class);
        PendingIntent pi=PendingIntent.getActivity(this,0,intent,0);
        Notification notification = new NotificationCompat.Builder(this).setContentTitle("good morining")
                .setContentText("this is content text").setWhen(System.currentTimeMillis())
                .setSmallIcon(R.mipmap.ic_launcher)
                .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_launcher))
                .setContentIntent(pi).build();

         startForeground(1,notification);//this is intern service 
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}/////end class